<?php

class Form_PreferencesForm extends Form_Custom_General {

    public function init() {
        $ADMIN_FROM_NAME = $this->createElement('text', 'ADMIN_FROM_NAME')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("preferences_required_admin_from_name"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60","class"=>"span6","placeholder"=>$this->translateObj->translate("preferences_frm_admin_from_name")));
        $this->addElement($ADMIN_FROM_NAME);
        
       $ADMIN_FROM = $this->createElement('text', 'ADMIN_FROM')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("preferences_required_admin_from"))))
                ->addValidator(new Zend_Validate_EmailAddress())
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array("size" => "60","class"=>"span6","placeholder"=>$this->translateObj->translate("preferences_frm_admin_from")));
       $ADMIN_FROM->getValidator('emailAddress')->setMessage($this->translateObj->translate("preferences_required_valid_admin_from"), Zend_Validate_EmailAddress::INVALID_FORMAT);
       $this->addElement($ADMIN_FROM);
        
        $ADMIN_REPLY_NAME = $this->createElement('text', 'ADMIN_REPLY_NAME')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("preferences_required_admin_to_name"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60","class"=>"span6","placeholder"=>$this->translateObj->translate("preferences_frm_admin_to_name")));
        $this->addElement($ADMIN_REPLY_NAME);
        
        $ADMIN_REPLY = $this->createElement('text', 'ADMIN_REPLY')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("preferences_required_admin_reply"))))
                ->addValidator(new Zend_Validate_EmailAddress())
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->setAttribs(Array("size" => "60","class"=>"span6","placeholder"=>$this->translateObj->translate("preferences_frm_admin_reply")));
        $ADMIN_REPLY->getValidator('emailAddress')->setMessage($this->translateObj->translate("preferences_required_valid_admin_reply"), Zend_Validate_EmailAddress::INVALID_FORMAT);
        $this->addElement($ADMIN_REPLY);
        
        $ADMIN_SIGN = $this->createElement('textarea', 'ADMIN_SIGN')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("preferences_required_admin_sign"))))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60","rows"=>3,"cols"=>10,"class"=>"span6","placeholder"=>$this->translateObj->translate("preferences_frm_admin_sign")));
        $this->addElement($ADMIN_SIGN);
        
        $digitValidator = new Zend_Validate_Digits();
        $digitValidator->setMessage('Record per page should be only in digits.');
        $PAGE_RECORD= $this->createElement('text', 'PAGE_RECORD')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("preferences_required_page_record"))))
                ->addValidator($digitValidator, true)
                ->addFilters(array(
                    new Zend_Filter_StringTrim()
                ))
                ->setAttribs(Array("size" => "60","class"=>"span6","placeholder"=>$this->translateObj->translate("preferences_frm_page_record")));
        $this->addElement($PAGE_RECORD);

         
        
        $DEFAULT_LANGUAGE = $this->createElement('select', 'DEFAULT_LANGUAGE')
                ->setRequired(TRUE)
                ->setAttribs(Array( "class" => "select2"))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))                
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->translateObj->translate("preferences_required_default_language"))));
        $this->addElement($DEFAULT_LANGUAGE);
        
        
        $submit = $this->createElement('submit', 'Save')
                ->setAttribs(Array('title' => "Save changes", 'class'=>"btn-glow primary"))
                ->setLabel($this->translateObj->translate("frm_save"));
        $this->addElement($submit);


     
    }

}